<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>个人资料 - 威客任务平台</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
    <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
            <a class="navbar-brand" href="/">威客任务平台</a>
            <div class="navbar-nav ms-auto">
                <a class="nav-link" th:href="@{/dashboard}">仪表板</a>
                <a class="nav-link" th:href="@{/profile}">个人资料</a>
                <form th:action="@{/logout}" method="post" class="d-inline-block">
                    <button type="submit" class="nav-link btn btn-link">退出</button>
                </form>
            </div>
        </div>
    </nav>

    <div class="container mt-4">
        <h2>个人资料</h2>
        
        <div th:if="${message}" class="alert alert-success" th:text="${message}"></div>
        <div th:if="${updateSuccess}" class="alert alert-success" th:text="${updateSuccess}"></div>
        
        <form th:action="@{/profile}" th:object="${user}" method="post">
            <div class="mb-3">
                <label for="username" class="form-label">用户名</label>
                <input type="text" class="form-control" id="username" th:field="*{username}" readonly>
            </div>
            <div class="mb-3">
                <label for="email" class="form-label">邮箱</label>
                <input type="email" class="form-control" id="email" th:field="*{email}" required>
            </div>
            <div class="mb-3">
                <label for="phone" class="form-label">手机号</label>
                <input type="text" class="form-control" id="phone" th:field="*{phone}">
            </div>
            <div class="mb-3">
                <label for="role" class="form-label">角色</label>
                <input type="text" class="form-control" id="role" th:field="*{role}" readonly>
            </div>
            <button type="submit" class="btn btn-primary">更新资料</button>
        </form>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>